﻿using Autofac;
using Zinnia.Lite.Initializer;
using Zinnia.Lite.Services;
using Zinnia.Lite.Services.Imp;
namespace Zinnia.Lite
{
    public class StartUpServices
    {
        private static object _lock = new object();
        private static bool _isInitializer = false;
        /// <summary>
        /// 初始化服务
        /// </summary>
        public static void Initializer(IServiceHub serviceHub)
        {
            //启动服务，单线程处理
            if (!_isInitializer)
            {
                lock (_lock)
                {
                    if (!_isInitializer)
                    {
                        //启动服务

                        //注入服务
                        serviceHub.Initialize();
                        //启动数据库服务
                        DataBaseInitializer.Initializer();
                        _isInitializer = true;
                    }
                }
            }
        }
    }
}
